<template>
	<div class="table-admin-container layout-padding">
        <el-card style="min-height: 700px ;">
            <h2>系统配置</h2>
            <div style="margin-bottom: 20px;"></div>
            <el-form style="width: 768px;">
                <el-form-item label="会员价格">
                    <el-input placeholder="请输入..." type="number" v-model="state.tableData.price"></el-input>
                </el-form-item>
                <el-form-item label="腾讯云cos">
                    <el-input placeholder="请输入.." v-model="state.tableData.cos"></el-input>
                </el-form-item>
                <el-form-item label="阿里云oss">
                    <el-input placeholder="请输入..." v-model="state.tableData.oss"></el-input>
                </el-form-item>
                <el-form-item label="微信appid">
                    <el-input placeholder="请输入..." v-model="state.tableData.appid"></el-input>
                </el-form-item>
                <el-form-item label="AppSecret">
                    <el-input placeholder="请输入..." v-model="state.tableData.appsecret"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">立即保存</el-button>
                </el-form-item>
            </el-form>
        </el-card>
	</div>
</template>

<script setup lang="ts" name="systemUser">
import { defineAsyncComponent, reactive, ref, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import { getList,save } from '/@/api/setting/index';

// 引入组件

// 定义变量内容
const tableRef = ref<RefType>();
const editRef = ref();
const state = reactive<TableDemoState>({
    tableData:{
        price:'',
        appsecret:'',
        appid:'',
        cos:'',
        oss:''
    }
});

// 初始化列表数据
const getTableData =  () => {
	getList(state.tableData.param).then((response: any) => {
        console.log('ddadasadasdas',response)
		state.tableData = response.data[0];
	});
};



/** 新增按钮操作 */
const onSubmit = () => {
	save(state.tableData).then((res:any) => {
        ElMessage.success({message:'保存成功',type:'success'})
        getTableData()
    })
};



// 页面加载时
onMounted(() => {
	getTableData();
});
</script>

<style scoped lang="scss">
.table-admin-container {
	.table-admin-padding {
		padding: 15px;
		.table-admin {
			flex: 1;
			overflow: hidden;
		}
	}
}
</style>
